﻿using Microsoft.AspNetCore.Mvc;
using SIMS.WebApi.Models;
using SIMS.WebApi.Services.Login;

namespace SIMS.WebApi.Controllers
{
    /// <summary>
    /// 菜单控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LoginController : ControllerBase
    {
        private readonly ILogger<LoginController> logger;

        private readonly ILoginAppService _service;

        public LoginController(ILogger<LoginController> logger, ILoginAppService service)
        {
            this.logger = logger;
            this._service = service;
        }

        [HttpPost]
        public IActionResult Login(AccountInfo account)
        {
            var data = _service.Login(account.username, account.password);

            var res = new ResultModel();
            res.code = 1;
            res.msg = "success";
            res.data = data;

            return Ok(res);
        }
    }
}
